package com.kobe.game_20;

import java.math.BigDecimal;

/**
 * 
 * 2^(15) = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
 * 
 * What is the sum of the digits of the number 2^(1000)?
 * 
 * 
 */
public class Game16 {

    public static void main(String[] args) {
        BigDecimal bd = new BigDecimal(2);
        long begin = System.currentTimeMillis();
        String value = bd.pow(100000).toString();
        long end = System.currentTimeMillis();
        System.out.println(end - begin);
        System.out.println(value.length());
        
        char[] valueChars = value.toCharArray();
        int result = 0;
        for (int i = 0; i < valueChars.length; i++) {
            char c = valueChars[i];
            result = result + Character.getNumericValue(c);
        }
        System.out.println(result);
    }
}
